/*
 * Copyright (c) 2022-2022 All rights Reserved.
 */

package com.driving.core;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import lombok.RequiredArgsConstructor;

/**
 * 排除页面相关请求
 *
 * @author SAGITTAR
 * @since 2017
 */
@RequiredArgsConstructor
@Component
public class DrivingCoreConfigurer implements WebMvcConfigurer {

    private final DrivingCoreInterceptor drivingCoreInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(drivingCoreInterceptor);
        registration.addPathPatterns("/**");
        // 排除拦截URL
        registration.excludePathPatterns("/", "/html/**", "/static/**", "/error", "/favicon.ico");
    }
}
